Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Controlling Movie Playback

This section describes a number of high-level functions provided by the Movie Toolbox that allow your application to play movies. For information about how to control a movie's playback rate, see "Working with Movie Time," .

You can use the StartMovie and StopMovie functions to start and stop movies.

The Movie Toolbox provides functions that can be used to control your position within a movie. You can use two functions, GoToBeginningOfMovie and GoToEndOfMovie , to set the position at either the beginning or the end of a movie. These functions are described in this section. Functions that work with time bases, such as SetMovieTimeValue and GetMovieTimeScale , can be used to control the current position anywhere within a movie. These advanced functions are described in "Functions That Modify Movie Properties," .

StartMovie

The StartMovie function starts the movie playing from the current movie time, which is where the movie last stopped playing. Before playing the movie, the Movie Toolbox makes the movie active, prerolls the movie, and sets the movie to its preferred playback rate. You can use the SetMoviePreferredRate function (described on SetMoviePreferredRate ) to change this setting.

pascal void StartMovie (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

Note that a movie's current time is saved when a movie is stored in a movie file. Therefore, your application should appropriately position a movie before playing the movie--use the GoToBeginningOfMovie function (described on GoToBeginningOfMovie ) to set a movie to play from its start.

You are not required to call StartMovie to start a movie. This function is included merely for convenience.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can also start a movie playing by calling the SetMovieRate function (described on SetMovieRate ) and setting the movie's rate to a nonzero value.

StopMovie

The StopMovie function stops the playback of a movie.

pascal void StopMovie (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can use the StartMovie function described in the previous section to resume playing.

GoToBeginningOfMovie

The GoToBeginningOfMovie function repositions a movie to play from its start.

pascal void GoToBeginningOfMovie (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

If you have defined an active movie segment, the GoToBeginningOfMovie function repositions to the start of the active segment. The active movie segment is the part of the movie that your application is interested in playing. By default, the active movie segment is set to be the entire movie. You may wish to change this to be some segment of the movie--for example, if you wish to play a user's selection repeatedly. By setting the active movie segment, you guarantee that the Movie Toolbox uses no samples from outside of that range while playing the movie.

If the movie is in preview mode, the function goes to the start of the preview segment of the movie. In all other cases, this function moves you to the start of the movie, where the movie time value is 0.

SPECIAL CONSIDERATIONS

Movies need not be at the start position when they are saved. The Movie Toolbox stores a movie's time position in the movie when it is saved. If you want to play a movie from the beginning, your application should call the GoToBeginningOfMovie function before playing a movie you have loaded from a movie file.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can use the SetMovieActiveSegment and GetMovieActiveSegment functions to work with the active segment. For details, see "Enhancing Movie Playback Performance," .

GoToEndOfMovie

The GoToEndOfMovie function repositions a movie to play from its end.

pascal void GoToEndOfMovie (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

If you have defined an active movie segment, the GoToEndOfMovie function repositions the movie to the end of the active segment. If the movie is in preview mode, the function goes to the end of the preview segment of the movie. In all other cases, this function moves you to the end of the movie.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can use the SetMovieActiveSegment and GetMovieActiveSegment functions to work with the active segment. For details, see "Enhancing Movie Playback Performance," .


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next